<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        
        <meta name="author" content="隐星魂 (Roy.Sun)">
        
        <link rel="shortcut icon" href="../../img/favicon.ico">
        <title>5.中断控制 - 玄武操作系统</title>
        <link href="../../css/bootstrap.min.css" rel="stylesheet">
        <link href="../../css/font-awesome.min.css" rel="stylesheet">
        <link href="../../css/base.css" rel="stylesheet">
        <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.3/styles/color-brewer.min.css">

        <script src="../../js/jquery-1.10.2.min.js" defer></script>
        <script src="../../js/bootstrap.min.js" defer></script>
        <script src="https://cdn.staticfile.org/highlight.js/10.0.3/highlight.min.js"></script>
        <script>hljs.initHighlightingOnLoad();</script> 
    </head>

    <body>
        <div class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
            <div class="container">
                <a class="navbar-brand" href="../..">玄武操作系统</a>
                <!-- Expander button -->
                <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar-collapse">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <!-- Expanded navigation -->
                <div id="navbar-collapse" class="navbar-collapse collapse">
                        <!-- Main navigation -->
                        <ul class="nav navbar-nav">
                            <li class="navitem">
                                <a href="../.." class="nav-link">主页</a>
                            </li>
                            <li class="navitem">
                                <a href="../../License/" class="nav-link">开源协议</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">快速开发指南 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">STM32</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../QuickGuide/stm32/01-Envsetup-Guide/" class="dropdown-item">01-开发环境搭建指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/stm32/02-atkh743/" class="dropdown-item">02-正点原子阿波罗H743开发板上手指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/stm32/03-fk429m/" class="dropdown-item">03-反客F429核心板上手指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/stm32/04-atkf103core/" class="dropdown-item">04-正点原子F103核心板上手指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/stm32/05-atkf407core/" class="dropdown-item">05-正点原子F407核心板上手指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/stm32/06-WeActH750/" class="dropdown-item">06-微行电子H750开发板上手指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/stm32/07-Project-From-Scratch-Guide/" class="dropdown-item">07-自定义工程配置指南</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">GD32</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../QuickGuide/gd32/01-Envsetup-Guide/" class="dropdown-item">01-开发环境搭建指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/gd32/02-Project-Setup-Guide/" class="dropdown-item">02-工程配置指南</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">GD32V</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../QuickGuide/gd32v/01-Envsetup-Guide/" class="dropdown-item">01-开发环境搭建指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/gd32v/02-Project-Setup-Guide/" class="dropdown-item">02-工程配置指南</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">NXP S32K</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../QuickGuide/s32k/01-Envsetup-Guide/" class="dropdown-item">01-开发环境搭建指南</a>
</li>
            
<li>
    <a href="../../QuickGuide/s32k/02-Project-Setup-Guide/" class="dropdown-item">02-工程配置指南</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">玄武内核模块</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../QuickGuide/xwko/01-XuanWuKO-Guide/" class="dropdown-item">01-上手指南</a>
</li>
    </ul>
  </li>
                                </ul>
                            </li>
                            <li class="dropdown active">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">应用手册 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
<li>
    <a href="../00-Index/" class="dropdown-item">0.目录</a>
</li>
                                    
<li>
    <a href="../01-Brief/" class="dropdown-item">1.简介</a>
</li>
                                    
<li>
    <a href="../02-Basic-System-Architecture/" class="dropdown-item">2.系统基本架构</a>
</li>
                                    
<li>
    <a href="../03-Build-System/" class="dropdown-item">3.构建系统</a>
</li>
                                    
<li>
    <a href="../04-Boot-Flow/" class="dropdown-item">4.启动流程</a>
</li>
                                    
<li>
    <a href="./" class="dropdown-item active">5.中断控制</a>
</li>
                                    
<li>
    <a href="../06-SKD/" class="dropdown-item">6.调度器</a>
</li>
                                    
<li>
    <a href="../07-Thread/" class="dropdown-item">7.线程</a>
</li>
                                    
<li>
    <a href="../08-SWT/" class="dropdown-item">8.软件定时器</a>
</li>
                                    
<li>
    <a href="../09-PM/" class="dropdown-item">9.电源管理</a>
</li>
                                    
<li>
    <a href="../10-Lock/" class="dropdown-item">10.锁</a>
</li>
                                    
<li>
    <a href="../11-Sync/" class="dropdown-item">11.同步</a>
</li>
                                    
<li>
    <a href="../12-MM/" class="dropdown-item">12.内存管理</a>
</li>
                                    
<li>
    <a href="../13-C-Lib/" class="dropdown-item">13.玄武C库</a>
</li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Lua手册 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
<li>
    <a href="../../LuaManual/00-Index/" class="dropdown-item">0.目录</a>
</li>
                                    
<li>
    <a href="../../LuaManual/01-Brief/" class="dropdown-item">1.简介</a>
</li>
                                    
<li>
    <a href="../../LuaManual/02-XWXT/" class="dropdown-item">2.全局导出表</a>
</li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">3.XWOS内核</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../LuaManual/03-XWOS/01-SDK/" class="dropdown-item">3.1.线程库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/02-Spinlock/" class="dropdown-item">3.2.自旋锁库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/03-Seqlock/" class="dropdown-item">3.3.顺序锁库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/04-Mutex/" class="dropdown-item">3.4.互斥锁库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/05-Semaphore/" class="dropdown-item">3.5.信号量库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/06-Condition/" class="dropdown-item">3.6.条件量库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/07-Flag/" class="dropdown-item">3.7.事件标志库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/08-Barrier/" class="dropdown-item">3.8.线程栅栏库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/09-Selector/" class="dropdown-item">3.9.信号选择器库</a>
</li>
            
<li>
    <a href="../../LuaManual/03-XWOS/10-PM/" class="dropdown-item">3.10.电源管理</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">4.玄武Lua函数库</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../LuaManual/04-XWLIB/01-Bitmap/" class="dropdown-item">4.1.位图</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">5.设备栈</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../LuaManual/05-XWDS/01-Soc/" class="dropdown-item">5.1.SOC</a>
</li>
            
<li>
    <a href="../../LuaManual/05-XWDS/02-GPIO/" class="dropdown-item">5.2.GPIO</a>
</li>
            
<li>
    <a href="../../LuaManual/05-XWDS/03-UART/" class="dropdown-item">5.3.UART</a>
</li>
            
<li>
    <a href="../../LuaManual/05-XWDS/04-SPI-Master/" class="dropdown-item">5.4.SPI Master</a>
</li>
            
<li>
    <a href="../../LuaManual/05-XWDS/05-IIC-Master/" class="dropdown-item">5.5.IIC Master</a>
</li>
    </ul>
  </li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">移植笔记 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
<li>
    <a href="../../PortingNote/00-Index/" class="dropdown-item">目录</a>
</li>
                                    
<li>
    <a href="../../PortingNote/01-Porting-Note/" class="dropdown-item">移植笔记</a>
</li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">ARM-Cortex-M</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../PortingNote/02-ARM-Cortex-M/01-ARM-Cortex-M-Porting-Note/" class="dropdown-item">架构移植笔记</a>
</li>
            
<li>
    <a href="../../PortingNote/02-ARM-Cortex-M/02-STM32-Porting-Note/" class="dropdown-item">STM32</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">RISC-V</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../PortingNote/03-RISC-V/01-GD32V-Porting-Note/" class="dropdown-item">GD32V</a>
</li>
    </ul>
  </li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">规范 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
<li>
    <a href="../../Specification/00-Index/" class="dropdown-item">目录</a>
</li>
                                    
<li>
    <a href="../../Specification/01-Git-Commit-Specification/" class="dropdown-item">git-commit规范</a>
</li>
                                    
<li>
    <a href="../../Specification/02-Version-Branch-Specification/" class="dropdown-item">版本分支规范</a>
</li>
                                </ul>
                            </li>
                        </ul>

                    <ul class="nav navbar-nav ml-auto">
                        <li class="nav-item">
                            <a href="#" class="nav-link" data-toggle="modal" data-target="#mkdocs_search_modal">
                                <i class="fa fa-search"></i> 搜索
                            </a>
                        </li>
                            <li class="nav-item">
                                <a rel="prev" href="../04-Boot-Flow/" class="nav-link">
                                    <i class="fa fa-arrow-left"></i> 上一篇
                                </a>
                            </li>
                            <li class="nav-item">
                                <a rel="next" href="../06-SKD/" class="nav-link">
                                    下一篇 <i class="fa fa-arrow-right"></i>
                                </a>
                            </li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="container">
            <div class="row">
                    <div class="col-md-3"><div class="navbar-light navbar-expand-md bs-sidebar hidden-print affix" role="complementary">
    <div class="navbar-header">
        <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target="#toc-collapse" title="Table of Contents">
            <span class="fa fa-angle-down"></span>
        </button>
    </div>

    
    <div id="toc-collapse" class="navbar-collapse collapse card bg-secondary">
        <ul class="nav flex-column">
            
            <li class="nav-item" data-level="1"><a href="#5" class="nav-link">5.中断控制</a>
              <ul class="nav flex-column">
            <li class="nav-item" data-level="2"><a href="#51" class="nav-link">5.1.描述</a>
              <ul class="nav flex-column">
              </ul>
            </li>
            <li class="nav-item" data-level="2"><a href="#52" class="nav-link">5.2.用法</a>
              <ul class="nav flex-column">
              </ul>
            </li>
            <li class="nav-item" data-level="2"><a href="#53" class="nav-link">5.3.示例</a>
              <ul class="nav flex-column">
              </ul>
            </li>
            <li class="nav-item" data-level="2"><a href="#53api" class="nav-link">5.3.API参考</a>
              <ul class="nav flex-column">
              </ul>
            </li>
            <li class="nav-item" data-level="2"><a href="#54" class="nav-link">5.4.附录</a>
              <ul class="nav flex-column">
              </ul>
            </li>
              </ul>
            </li>
        </ul>
    </div>
</div></div>
                    <div class="col-md-9" role="main">

<h1 id="5">5.中断控制</h1>
<h2 id="51">5.1.描述</h2>
<p>玄武OS将中断分为ARCH IRQ和SOC IRQ：
+   ARCH IRQ是指架构中定义的中断，或被成为<strong>异常</strong>，中断号用负数表示；
+   SOC IRQ是指外设中断，例如UART的中断等，中断号用0和正数表示。</p>
<h2 id="52">5.2.用法</h2>
<h3 id="_1">中断优先级</h3>
<ul>
<li>玄武OS对中断优先级的要求：</li>
</ul>
<pre><code>切换上下文的中断 &lt;= 滴答定时器的中断 &lt; 其他中断 &lt; 调度器服务中断
</code></pre>

<h3 id="_2">中断向量</h3>
<p>中断向量通常位于<code>vector.c</code>文件中，此文件可以存放在</p>
<ul>
<li><code>xwbd/电路板名称/bdl</code>中</li>
<li><code>xwbd/电路板名称/bm</code>下的某个<a href="../03-Build-System/#BS-XWMO">玄武模块</a>中</li>
</ul>
<p>中断向量可以是只读的或可修改的，这与<code>xwbd/电路板名称/cfg/soc.h</code>中配置有关。</p>
<ul>
<li><code>SOCCFG_RO_ISRTABLE</code>配置为1：
    中断向量表位于code段，不可修改。</li>
<li><code>SOCCFG_RO_ISRTABLE</code>配置为0：
    中断向量表位于data段，可在程序运行时修改，但会消耗额外的RAM。</li>
</ul>
<h3 id="cpu">CPU总中断开关</h3>
<p>玄武OS可以对CPU的总中断开关进行操作：</p>
<ul>
<li>关闭：<code>xwos_cpuirq_disable_lc()</code></li>
<li>开启：<code>xwos_cpuirq_enable_lc()</code><ul>
<li>关闭与开启这一组API需要确保不会发生嵌套，例如下面的嵌套代码就是<strong>错误</strong>的：</li>
</ul>
</li>
</ul>
<pre><code class="C">void func1(void)
{
        xwos_cpuirq_disable_lc();
        /* ... 临界区 ... */
        xwos_cpuirq_enable_lc();
}

void func0(void)
{
        xwos_cpuirq_disable_lc();
        /* ... 临界区 ... */
        /* 错误！func1()会导致CPU中断开关被打开，
           导致后面的临界区处于未保护状态。 */
        func1();
        /* ... 临界区 ... */
        xwos_cpuirq_enable_lc();
}
</code></pre>

<ul>
<li>保存当前开关状态后关闭：<code>xwos_cpuirq_save_lc()</code></li>
<li>恢复之前保存的状态：<code>xwos_cpuirq_restore_lc()</code><ul>
<li>当关闭中断的代码发生嵌套时，应当使用保存与恢复这一组API，上面的例子可以更正为：</li>
</ul>
</li>
</ul>
<pre><code class="C">void func1(void)
{
        xwreg_t cpuirq;

        xwos_cpuirq_save_lc(&amp;cpuirq);
        /* ... 临界区 ... */
        xwos_cpuirq_restore_lc(cpuirq);
}

void func0(void)
{
        xwreg_t cpuirq;

        xwos_cpuirq_save_lc(&amp;cpuirq);
        /* ... 临界区 ... */
        func1();
        /* ... 临界区 ... */
        xwos_cpuirq_restore_lc(cpuirq);
}
</code></pre>

<h3 id="_3">外设中断</h3>
<p>玄武OS可以对CPU的外设中断单独控制：</p>
<ul>
<li>申请中断：<code>xwos_irq_request()</code><ul>
<li>此API用于安装中断处理函数及其参数，此API需要将中断向量表配置
    为可读写的，参考<a href="#IRQ-CFG">中断控制-配置</a>。</li>
</ul>
</li>
<li>释放中断：<code>xwos_irq_release()</code><ul>
<li>此API用于释放已安装的中断处理函数以及其参数。</li>
</ul>
</li>
<li>开启中断：<code>xwos_irq_enable()</code></li>
<li>关闭中断：<code>xwos_irq_disable()</code></li>
<li>保存中断的开关标志，然后将其关闭：<code>xwos_irq_save()</code></li>
<li>恢复中断的开关标志：<code>xwos_irq_restore()</code></li>
<li>挂起中断标志：<code>xwos_irq_pend()</code><ul>
<li>此API用于通过软件强制将一个外设中断挂起，这个操作需要移植相关的代码中提供
    相应的函数支持；</li>
</ul>
</li>
<li>清除中断标志：<code>xwos_irq_clear()</code><ul>
<li>此API用于通过软件强制将一个外设中断清除，这个操作需要移植相关的代码中提供
    相应的函数支持；</li>
</ul>
</li>
<li>配置中断：<code>xwos_irq_cfg()</code><ul>
<li>此API用于配置外设中断，参数<code>soc_irq_cfg</code>是一个与架构相关的数据结构，不同
    架构定义不同。在移植时，应该在<code>xwosimpl_soc_irq.h</code>中给出<code>soc_irq_cfg</code>的
    具体定义。例如stm32h7x，此文件的路径为<code>xwcd/soc/arm/v7m/gcc/m7/stm32h7x/xwosimpl_soc_irq.h</code>。</li>
</ul>
</li>
<li>获取中断的配置：<code>xwos_irq_get_cfg()</code><ul>
<li>此API用于获取外设中断配置，参数<code>soc_irq_cfg</code>是一个与架构相关的数据结构，不同
    架构定义不同。在移植时，应该在<code>xwosimpl_soc_irq.h</code>中给出<code>soc_irq_cfg</code>的
    具体定义。例如stm32h7x，此文件的路径为<code>xwcd/soc/arm/v7m/gcc/m7/stm32h7x/xwosimpl_soc_irq.h</code>。</li>
</ul>
</li>
<li>获取中断的数据：<code>xwos_irq_get_data()</code><ul>
<li>获取中断处理函数的参数。</li>
</ul>
</li>
<li>获取当前上下文的中断号：<code>xwos_irq_get_id()</code><ul>
<li>此API可用于判断当前上下文：<ul>
<li>函数返回错误码<code>-EINTHRD</code>：表示当前上下文为线程</li>
<li>函数返回错误码<code>-EINBH</code>：表示当前上下文为中断底半部</li>
<li>函数返回错误码<code>XWOK</code>：表示当前上下文为中断，并且可从参数指定的
    缓冲区中获取当前中断的中断号，此API需要移植时提供
    函数<code>xwer_t xwospl_irq_get_id(xwirq_t * irqnbuf)</code>的实现。</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="53">5.3.示例</h2>
<h3 id="cpu_1">CPU总中断</h3>
<ul>
<li>应用模块：<code>xwam/example/lock/cpuirq</code></li>
<li>用法：<ul>
<li>在配置文件<code>xwbd/电路板名称/cfg/xwam.h</code>中
    定义宏<code>XWAMCFG_example_lock_cpuirq</code>为<code>1</code>；</li>
<li>在初始化流程中（例如：<code>xwos_main()</code>）调用<code>example_cpuirq_start()</code>启动模块。</li>
</ul>
</li>
</ul>
<h3 id="_4">外设中断</h3>
<p>可以参考ARMv7-m架构初始化切换上下文的中断：</p>
<pre><code class="C">/* xwcd/soc/arm/v7m/gcc/arch_sched.c */
__xwbsp_rodata const struct soc_irq_cfg cortex_m_swcx_irq_cfg = {
        .irqcfg = {
                .priority = ARCH_IRQ_SWCX_PRIO,
        },
};

__xwbsp_rodata const struct xwos_irq_resource cortex_m_swcx_irqrsc = {
        .irqn = ARCH_IRQ_PENDSV,
        .isr = arch_scheduler_isr_swcx,
        .cfg = &amp;cortex_m_swcx_irq_cfg,
        .description = &quot;rsc.irq.swcx.armv7m&quot;,
};

__xwbsp_code
xwer_t arch_scheduler_lib_init_pendsv(struct xwos_scheduler * xwsd)
{
        xwer_t rc;
        const struct xwos_irq_resource * irqrsc;

        UNUSED(xwsd);

        /* 申请中断 */
        irqrsc = &amp;cortex_m_swcx_irqrsc;
        rc = xwos_irq_request(irqrsc-&gt;irqn, irqrsc-&gt;isr);
        BUG_ON(rc &lt; 0);

        /* 配置中断 */
        rc = xwos_irq_cfg(irqrsc-&gt;irqn, irqrsc-&gt;cfg);
        BUG_ON(rc &lt; 0);

        /* 开启中断 */
        rc = xwos_irq_enable(irqrsc-&gt;irqn);
        BUG_ON(rc &lt; 0);

        return rc;
}
</code></pre>

<h3 id="_5">配置</h3>
<p><a id="IRQ-CFG"></a></p>
<h5 id="cfgarchh">cfg/arch.h</h5>
<ul>
<li><code>ARCHCFG_IRQ_NUM</code>：架构中断（异常）数量；</li>
</ul>
<h5 id="cfgsoch">cfg/soc.h</h5>
<ul>
<li><code>SOCCFG_IRQ_NUM</code>：SOC中断数量；</li>
<li><code>SOCCFG_RO_ISRTABLE</code>：中断向量表是否为const的，取值：1|0；</li>
</ul>
<h2 id="53api">5.3.API参考</h2>
<ul>
<li>头文件：<code>xwos/osal/irq.h</code></li>
<li>注释：见头文件</li>
</ul>
<h2 id="54">5.4.附录</h2>
<ul>
<li><a href="../00-Index/">返回目录</a></li>
</ul></div>
            </div>
        </div>

        <footer class="col-md-12">
            <hr>
            <p>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a>.</p>
        </footer>
        <script>
            var base_url = "../..",
                shortcuts = {"help": 191, "next": 78, "previous": 80, "search": 83};
        </script>
        <script src="../../js/base.js" defer></script>
        <script src="../../search/main.js" defer></script>

        <div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="searchModalLabel">搜索</h4>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
                <p>
                    在这里所有文档：
                </p>
                <form>
                    <div class="form-group">
                        <input type="search" class="form-control" placeholder="搜索..." id="mkdocs-search-query" title="Type search term here">
                    </div>
                </form>
                <div id="mkdocs-search-results"></div>
            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
              <table class="table">
                <thead>
                  <tr>
                    <th style="width: 20%;">Keys</th>
                    <th>Action</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td class="help shortcut"><kbd>?</kbd></td>
                    <td>Open this help</td>
                  </tr>
                  <tr>
                    <td class="next shortcut"><kbd>n</kbd></td>
                    <td>Next page</td>
                  </tr>
                  <tr>
                    <td class="prev shortcut"><kbd>p</kbd></td>
                    <td>Previous page</td>
                  </tr>
                  <tr>
                    <td class="search shortcut"><kbd>s</kbd></td>
                    <td>Search</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div>

    </body>
</html>
